/*
 * ScreenOperations.cpp
 *
 *  Created on: 19 Jan 2011
 *      Author: sinan
 */

#include "ScreenOperations.h"
#include "../3DFigures/King.h"
#include "../3DFigures/Pawn.h"
#include "../3DFigures/Rook.h"
#include "../3DFigures/Bishop.h"
#include "../3DFigures/Knight.h"
#include "../3DFigures/Queen.h"
#include <GL/glut.h>

/* white ambient light at half intensity (rgba) */
GLfloat LightAmbientBlack[] = { 0.1f, 0.1f, 0.1f, 1.0f };

/* super bright, full intensity diffuse light. */
GLfloat LightDiffuseBlack[] = { 0.1f, 0.1f, 0.1f, 0.1f };

/* position of light (x, y, z, (position of light)) */
GLfloat LightPositionBlack[] = { 1.0f, 1.0f, 2.0f, 2.0f };
GLfloat LightPositionBlack2[] = { -1.0f, 1.0f, 2.0f, 2.0f };

/* white ambient light at half intensity (rgba) */
GLfloat LightAmbientWhite[] = { 0.6f, 0.6f, 0.6f, 1.0f };

/* super bright, full intensity diffuse light. */
GLfloat LightDiffuseWhite[] = { 0.6f, 0.6f, 0.6f, 0.1f };

/* position of light (x, y, z, (position of light)) */
GLfloat LightPositionWhite[] = { 0.0f, 0.0f, 2.0f, 1.0f };
GLfloat LightPositionWhite2[] = { 1.0f, -1.0f, 2.0f, 2.0f };

ScreenOperations::ScreenOperations() {
	// TO DO Auto-generated constructor stub

}

ScreenOperations::~ScreenOperations() {
	// TO DO Auto-generated destructor stub
}

void ScreenOperations::ShowPossibleMovementsOfSelectedChessMan() {

	int i = 0;
	for (i = 0; i < ChessTable::selectedCoordinateMovementList.size(); i++) {
		if (ChessTable::selectedCoordinateMovementList.at(i).coordType
				== ChessManVisitableCoordinateType_Attack) {
			glColor3f(0.6, 0.0, 0.0);
		} else if (ChessTable::selectedCoordinateMovementList.at(i).coordType
				== ChessManVisitableCoordinateType_NoAttack) {
			glColor3f(0.0, 0.0, 0.9);
		}
		DrawRectangleForPossibleMovements(
				ChessTable::selectedCoordinateMovementList.at(i).ctCoord.x,
				ChessTable::selectedCoordinateMovementList.at(i).ctCoord.y);
	}

	glColor3f(0.0, 0.0, 0.4);
	//	DrawRectangleForPossibleMovements(Game::ChosenChessManCoordinate.x,
	//		Game::ChosenChessManCoordinate.y);
	//secilen tasın karesinin cizildigi alan
	DrawRectangleForPossibleMovements(ChessTable::selectedCoordinate.x,
			ChessTable::selectedCoordinate.y);
}

void ScreenOperations::DrawRectangleForPossibleMovements(int x, int y) {

	Coordinate c;

	GLfloat upLeftNode[3];
	GLfloat upRightNode[3];
	GLfloat downLeftNode[3];
	GLfloat downRightNode[3];

	/*
	 if (x > 3 && y > 3) // 1. bölge
	 {
	 upLeftNode[0] = (x - 4) * 0.246 + 0.005;
	 upLeftNode[1] = (y - 4 + 1) * 0.262 + 0.008;
	 upLeftNode[2] = 0.0;

	 downLeftNode[0] = (x - 4) * 0.246 + 0.005;
	 downLeftNode[1] = (y - 4) * 0.262 + 0.008;
	 downLeftNode[2] = 0.0f;

	 upRightNode[0] = (x - 4 + 1) * 0.246 + 0.005;
	 upRightNode[1] = (y - 4 + 1) * 0.262 + 0.008;
	 upRightNode[2] = 0.0f;

	 downRightNode[0] = (x - 4 + 1) * 0.246 + 0.005;
	 downRightNode[1] = (y - 4) * 0.262 + +0.008;
	 downRightNode[2] = 0.0f;

	 } else if (x > 3 && y < 4) // 4. bölge
	 {
	 upLeftNode[0] = (x - 4) * 0.246 + 0.005;
	 upLeftNode[1] = (y - 3) * 0.262 + 0.004;
	 upLeftNode[2] = 0.0f;

	 downLeftNode[0] = (x - 4) * 0.246 + 0.005;
	 downLeftNode[1] = (y - 3 - 1) * 0.262 + 0.008;
	 downLeftNode[2] = 0.0f;

	 upRightNode[0] = (x - 4 + 1) * 0.246 + 0.005;
	 upRightNode[1] = (y - 3) * 0.262 + 0.004;
	 upRightNode[2] = 0.0f;

	 downRightNode[0] = (x - 4 + 1) * 0.246 + 0.005;
	 downRightNode[1] = (y - 3 - 1) * 0.262 + 0.008;
	 downRightNode[2] = 0.0f;

	 } else if (x < 4 && y > 3) // 2. bölge
	 {
	 upLeftNode[0] = (x - 3) * 0.248 + 0.005;
	 upLeftNode[1] = (y - 4 + 1) * 0.264 + 0.008;
	 upLeftNode[2] = 0.0;

	 downLeftNode[0] = (x - 3) * 0.248 + 0.005;
	 downLeftNode[1] = (y - 4) * 0.264 + 0.008;
	 downLeftNode[2] = 0.0f;

	 upRightNode[0] = (x - 3 - 1) * 0.248 + 0.005;
	 upRightNode[1] = (y - 4 + 1) * 0.264 + 0.008;
	 upRightNode[2] = 0.0f;

	 downRightNode[0] = (x - 3 - 1) * 0.248 + 0.005;
	 downRightNode[1] = (y - 4) * 0.264 + 0.008;
	 downRightNode[2] = 0.0f;

	 } else if (x < 4 && y < 4) // 3. bölge
	 {
	 upLeftNode[0] = (x - 3) * 0.248 + 0.005;
	 upLeftNode[1] = (y - 3) * 0.264 + 0.008;
	 upLeftNode[2] = 0.0f;

	 downLeftNode[0] = (x - 3) * 0.248 + 0.005;
	 downLeftNode[1] = (y - 3 - 1) * 0.264 + 0.008;
	 downLeftNode[2] = 0.0f;

	 upRightNode[0] = (x - 3 - 1) * 0.248 + 0.005;
	 upRightNode[1] = (y - 3) * 0.264 + 0.008;
	 upRightNode[2] = 0.0f;

	 downRightNode[0] = (x - 3 - 1) * 0.248 + 0.005;
	 downRightNode[1] = (y - 3 - 1) * 0.264 + 0.008;
	 downRightNode[2] = 0.0f;
	 }
	 */

	upLeftNode[0] = x*0.2445; // x * 2445;
	upLeftNode[1] = (y+1)*0.2633; // (y+1) * 2632;
	upLeftNode[2] = 0.0f;

	downLeftNode[0] = x*0.2445; // x * 0.237;
	downLeftNode[1] = y*0.2633; // y * 0.25;
	downLeftNode[2] = 0.0f;

	upRightNode[0] = (x+1)*0.2445; // (x+1) * 0.237;
	upRightNode[1] = (y+1)*0.2633; // (y+1) * 0.25;
	upRightNode[2] = 0.0f;

	downRightNode[0] = (x+1)*0.2445; // (x+1) * 0.237;
	downRightNode[1] = y*0.2633; // y * 0.25;
	downRightNode[2] = 0.0f;

	// 2f ile dene
	glPushMatrix();

	glTranslatef(-0.975, -1.035, 0);

	glBegin(GL_QUADS);
	glVertex3f(upLeftNode[0], upLeftNode[1], upLeftNode[2]);
	glVertex3f(downLeftNode[0], downLeftNode[1], downLeftNode[2]);
	glVertex3f(downRightNode[0], downRightNode[1], downRightNode[2]);
	glVertex3f(upRightNode[0], upRightNode[1], upRightNode[2]);
	glEnd();

	glBegin(GL_LINE_STRIP);
	glColor3f(0.1, 0.1, 0.1);
	glVertex3f(upLeftNode[0], upLeftNode[1], upLeftNode[2]);
	glVertex3f(downLeftNode[0], downLeftNode[1], downLeftNode[2]);
	glVertex3f(downRightNode[0], downRightNode[1], downRightNode[2]);
	glVertex3f(upRightNode[0], upRightNode[1], upRightNode[2]);
	glEnd();

	glPopMatrix();

}

void ScreenOperations::WriteToScreen(float x, float y, string string) {

	int len, i;
	glRasterPos2f(x, y);
	len = (int) string.size();
	for (i = 0; i < len; i++) {
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, (char) string.at(i));
	}
}

void ScreenOperations::DetermineDeadChessMenFigures(
		vector<ChessMan> deadChessMen) {

	int i;

	if (deadChessMen.empty()) {
		return; // boşsa devam et..
	}

	glPushMatrix();

	if (deadChessMen.at(0).color == ChessManColor_White) {
		glTranslatef(1.23, -0.95, 0.0);
		glColor3f(0.9, 0.9, 0.9);
		glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbientWhite); // add lighting. (ambient)
		glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuseWhite); // add lighting. (diffuse).
		glLightfv(GL_LIGHT1, GL_POSITION, LightPositionWhite); // set light position.
	} else {
		glTranslatef(-1.23, -0.95, 0.0);
		glColor3f(0.1, 0.1, 0.1);
		glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbientBlack); // add lighting. (ambient)
		glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuseBlack); // add lighting. (diffuse).
		glLightfv(GL_LIGHT1, GL_POSITION, LightPositionBlack); // set light position.
	}

	glEnable(GL_LIGHT1); // turn light 1 on.
	glEnable(GL_LIGHTING);

	for (i = 0; i < deadChessMen.size(); i++) {

		glPushMatrix();
		switch (deadChessMen.at(i).type) {
		case ChessManType_Bishop:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.14f);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.14f);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.14f);

			}
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glScalef(0.31f, 0.31f, 0.3f);
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, BishopVerts);
			glNormalPointer(GL_FLOAT, 0, BishopNormals);
			glDrawArrays(GL_TRIANGLES, 0, BishopNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		case ChessManType_King:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.19f);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.19f);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.19f);

			}
			glScalef(0.4f, 0.4f, 0.4f);
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f); // hac görünmesi icin
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, KingVerts);
			glNormalPointer(GL_FLOAT, 0, KingNormals);
			glDrawArrays(GL_TRIANGLES, 0, KingNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		case ChessManType_Knight:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.08f);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.08f);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.08f);

			}
			glScalef(0.27f, 0.27f, 0.3f);
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, KnightVerts);
			glNormalPointer(GL_FLOAT, 0, KnightNormals);
			glDrawArrays(GL_TRIANGLES, 0, KnightNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		case ChessManType_Pawn:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.102f);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.102);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.102f);

			}
			glScalef(0.22f, 0.22f, 0.22f);
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, PawnVerts);
			glNormalPointer(GL_FLOAT, 0, PawnNormals);
			glDrawArrays(GL_TRIANGLES, 0, PawnNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		case ChessManType_Queen:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.178f);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.178);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.178f);

			}
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glScalef(0.34f, 0.34f, 0.35f);
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, QueenVerts);
			glNormalPointer(GL_FLOAT, 0, QueenNormals);
			glDrawArrays(GL_TRIANGLES, 0, QueenNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		case ChessManType_Rook:
			if (i > 8) //denebilir ikinci satır icin
			{
				if (deadChessMen.at(i).color == ChessManColor_White) {
					glTranslatef(0.2, (i - 9) * 0.21, 0.123);
				} else {
					glTranslatef(-0.2, (i - 9) * 0.21, 0.123);
				}

			} else {
				glTranslatef(0, i * 0.21, 0.123);

			}
			glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
			glScalef(0.25f, 0.25f, 0.25f);
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_NORMAL_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, RookVerts);
			glNormalPointer(GL_FLOAT, 0, RookNormals);
			glDrawArrays(GL_TRIANGLES, 0, RookNumVerts);
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_NORMAL_ARRAY);
			break;
		default:
			break;
		}
		glPopMatrix();
	}
	glDisable(GL_LIGHT1); // turn light 1 on.
	glDisable(GL_LIGHTING);

	glPopMatrix();

}

void ScreenOperations::DetermineChessMenFiguresOnChessTable() {

	int i, j;
	Coordinate coord;

	for (i = 0; i < 8; i++) {
		for (j = 0; j < 8; j++) {
			if (ChessTable::ChessTableMatrix[j][i].color != ChessManColor_NULL
					&& ChessTable::ChessTableMatrix[j][i].type
							!= ChessManType_NULL) // bos degilse rengini ve tipini belirle
			{

				switch (ChessTable::ChessTableMatrix[j][i].color) {
				case ChessManColor_Black:
					glColor3f(0.1, 0.1, 0.1);
					glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbientBlack); // add lighting. (ambient)
					glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuseBlack); // add lighting. (diffuse).
					glLightfv(GL_LIGHT1, GL_POSITION, LightPositionBlack); // set light position.
					glEnable(GL_LIGHT1); // turn light 1 on.
					glEnable(GL_LIGHTING);
					break;
				case ChessManColor_White:
					glColor3f(0.9, 0.9, 0.9);
					glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbientWhite); // add lighting. (ambient)
					glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuseWhite); // add lighting. (diffuse).
					glLightfv(GL_LIGHT1, GL_POSITION, LightPositionWhite); // set light position.
					glEnable(GL_LIGHT1); // turn light 1 on.
					glEnable(GL_LIGHTING);
					break;
				default:
					break;
				}

				glPushMatrix();
				switch (ChessTable::ChessTableMatrix[j][i].type) {
				case ChessManType_Bishop:

					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y, 0.14f);

					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					glScalef(0.31f, 0.31f, 0.3f);
					//glScalef(0.37f, 0.35f, 0.3f);

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, BishopVerts);
					glNormalPointer(GL_FLOAT, 0, BishopNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, BishopTexCoords);
					// draw data
					glDrawArrays(GL_TRIANGLES, 0, BishopNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);

					break;
				case ChessManType_King:
					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y, 0.19f);
					glScalef(0.4f, 0.4f, 0.4f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					//glRotatef(5.0f, 0.0f, 1.0f, 0.0f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f); // hac görünmesi icin

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, KingVerts);
					glNormalPointer(GL_FLOAT, 0, KingNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, KingmeshTexCoords);
					// draw data
					glDrawArrays(GL_TRIANGLES, 0, KingNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
					break;

				case ChessManType_Knight:
					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y, 0.08f);
					glScalef(0.27f, 0.27f, 0.3f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					//glRotatef(10.0f, 0.0f, 1.0f, 0.0f);

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, KnightVerts);
					glNormalPointer(GL_FLOAT, 0, KnightNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, KnightTexCoords);

					// draw data
					glDrawArrays(GL_TRIANGLES, 0, KnightNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
					break;
				case ChessManType_Pawn:

					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y,
							0.102f);
					glScalef(0.22f, 0.22f, 0.22f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					//glRotatef(10.0f, 0.0f, 1.0f, 0.0f);

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, PawnVerts);
					glNormalPointer(GL_FLOAT, 0, PawnNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, PawnTexCoords);
					// draw data
					glDrawArrays(GL_TRIANGLES, 0, PawnNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
					break;

				case ChessManType_Queen:
					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y,
							0.178f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					//glRotatef(10.0f, 0.0f, 1.0f, 0.0f);
					//	glScalef(0.38f, 0.37f, 0.35f); eskisi

					glScalef(0.34f, 0.34f, 0.35f);

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, QueenVerts);
					glNormalPointer(GL_FLOAT, 0, QueenNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, QueenTexCoords);
					// draw data
					glDrawArrays(GL_TRIANGLES, 0, QueenNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
					break;

				case ChessManType_Rook:
					glTranslatef(coord.DetermineCoordinateForChessMan(j, i).x,
							coord.DetermineCoordinateForChessMan(j, i).y,
							0.123f);
					glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
					//glRotatef(10.0f, 0.0f, 1.0f, 0.0f);
					glScalef(0.25f, 0.25f, 0.25f);

					glEnableClientState(GL_VERTEX_ARRAY);
					glEnableClientState(GL_NORMAL_ARRAY);
					//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

					glVertexPointer(3, GL_FLOAT, 0, RookVerts);
					glNormalPointer(GL_FLOAT, 0, RookNormals);
					//glTexCoordPointer(2, GL_FLOAT, 0, RookTexCoords);
					// draw data
					glDrawArrays(GL_TRIANGLES, 0, RookNumVerts);

					glDisableClientState(GL_VERTEX_ARRAY);
					glDisableClientState(GL_NORMAL_ARRAY);
					//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
					break;
				default:
					break;
				}
				glPopMatrix();
				glDisable(GL_LIGHT1);
				glDisable(GL_LIGHT2);
				glDisable(GL_LIGHTING);
			} // end of if

		} // end of for J
	} // end of for I

	DetermineDeadChessMenFigures(ChessTable::ChessMenDeadWhite);
	DetermineDeadChessMenFigures(ChessTable::ChessMenDeadBlack);

}

void ScreenOperations::ShowGameMessage() {
	string cpTurn;

	if (Game::chessPlayerTurn == ChessPlayerTurn_White) {
		cpTurn = "White: ";
		cpTurn.append(Game::gameMessage.message);
		WriteToScreen(-3.5, 2.5, cpTurn);
	} else if (Game::chessPlayerTurn == ChessPlayerTurn_Black) {
		cpTurn = "Black: ";
		cpTurn.append(Game::gameMessage.message);
		WriteToScreen(3.5, -2.5, cpTurn);
	}
}

